cmake_minimum_required(VERSION 3.0)

project(SERVE-FRAMEWORK)

set(CMAKE_VERBOSE_MAKEFILE ON) #显示编码详细内容
set(CMAKE_BUILD_TYPE Debug)

set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_COMPILER g++-13)
set(CMAKE_CXX_FLAGS "-Wall")
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

set(fileList 
    source/fiber.cpp
    source/scheduler.cpp
    source/util.cpp
    source/io_manager.cpp
    source/timer.cpp
    source/hook.cpp
    source/fd_manager.cpp
    source/address.cpp
    source/socket.cpp
    source/byte_array.cpp
    source/http/http.cpp
    source/http/http11_parser.cpp         #.rl 生成文件
    source/http/httpclient_parser.cpp     #.rl 生成文件
    source/http/http_parser.cpp
    source/tcp_server.cpp
    source/stream.cpp
    source/streams/socket_stream.cpp
    source/http/http_session.cpp
    source/http/http_server.cpp
    source/http/servlet.cpp
    source/http/http_connection.cpp
    source/uri.cpp                        #.rl 生成文件
    )

set(LIB pthread
    dl  #Centos使用dlsym函数时使用
)

# add_executable(testIOManager test/testIOManager.cpp ${fileList})
add_executable(testHook test/testHook.cpp ${fileList})
add_executable(testAddr test/testAddress.cpp ${fileList})
add_executable(testSocket test/testSocket.cpp ${fileList})
add_executable(testByteArray test/testByteArray.cpp ${fileList})
add_executable(testHttp test/testHttp.cpp ${fileList})
add_executable(testHttpParser test/testHttpParser.cpp ${fileList})
add_executable(testTcpServer test/testTcpServer.cpp ${fileList})
add_executable(testHttpServer test/testHttpServer.cpp ${fileList})
add_executable(testHttpConnection test/testHttpConnection.cpp ${fileList})
add_executable(testUri test/testUri.cpp ${fileList})

add_executable(echoServer examples/echoServer.cpp ${fileList})


# target_link_libraries(testIOManager ${LIB})
target_link_libraries(testHook ${LIB})
target_link_libraries(testAddr ${LIB})
target_link_libraries(testSocket ${LIB})
target_link_libraries(testByteArray ${LIB})
target_link_libraries(testHttp ${LIB})
target_link_libraries(testHttpParser ${LIB})
target_link_libraries(testTcpServer ${LIB})
target_link_libraries(testHttpServer ${LIB})
target_link_libraries(testHttpConnection ${LIB})
target_link_libraries(testUri ${LIB})

target_link_libraries(echoServer ${LIB})